<?php
namespace app\api\controller;
use think\DB;
class TsController extends BaseController{

	public function index(){
		/*
		DB::startTrans();
		try{
			$userInfo = model('Users')->lock(true)->where('id', 11)->find();//加锁
			model('Users')->update(['nickname' => 'liwenrui'], ['id' => 14]);
			sleep(2);
			DB::commit();//事务提交
			return date('H:i:s');
		} catch (\Exception $e) {
			DB::rollback();
			throw $e;
		}
		*/
		$data	= model('Users')->lockwrite();
		return json($data);
	}
	public function getCreditType(){
		$res=db('rechange_type')->where(['state'=>1])->order('sort desc,id asc')->select();
		return json(['code'=>1,'data'=>$res]);
	}
	public function getPledgeType(){
		$res=db('pledge_tax')->where(['status'=>1])->order('sort desc,id asc')->select();
		return json(['code'=>1,'data'=>$res]);
	}
	//获取版税设置
	public function getTaxSet(){
        $data= db('tax_sets')->find(1);
        return json(['code'=>1,'data'=>$data]);
    }

}
